package com.crscd.ai.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2025/9/24-21:42
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Component
public class CalculatorTools {
  @Tool(name = "加法", value = "将两个参数a和参数b相加并返回运算结果")
  public double sum(
      @ToolMemoryId int memoryId,
      @P(value = "加数1", required = true) double a,
      @P(value = "加数2") double b) {
    System.out.println("调用加法运算运算" + a + "+" + b);
    return a + b;
  }

  @Tool("平方根运算")
  public double squareRoot(@ToolMemoryId int memoryId, double a) {
    System.out.println("计算数字" + a + "的平方根");
    return Math.sqrt(a);
  }
}
